package com.xuzimian.globaldemo.spring.core.aop;

import com.xuzimian.globaldemo.spring.core.aop.pointcut.PointCutArgService;
import com.xuzimian.globaldemo.spring.core.aop.pointcut.PointCutNoArgService;
import org.junit.jupiter.api.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * 测试 test 分支修改
 */
public class SpringAopDemo {


    //我是主干上的修改

    @Test
    public void testNoArgs() {
        ApplicationContext ctx = new ClassPathXmlApplicationContext("classpath:spring-aop.xml");
        PointCutNoArgService service = (PointCutNoArgService) ctx.getBean("pointCutNoArgService");
        service.add("add1", "add2");
        System.out.println("---------------------------------");
        service.edit("edit1","edit2");
        System.out.println("---------------------------------");
        service.delete("delete1", "delete2");
        System.out.println("---------------------------------");
    }

    @Test
    public void testArgs() {
        ApplicationContext ctx = new ClassPathXmlApplicationContext("classpath:spring-aop.xml");
        PointCutArgService service = (PointCutArgService) ctx.getBean("pointCutArgService");
        service.add("add1", "add2");
        System.out.println("---------------------------------");
        service.edit("edit1","edit2");
        System.out.println("---------------------------------");
        service.delete("delete1", "delete2");
        System.out.println("---------------------------------");
    }
}
